package ar.view.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import ar.activity.R;
import ar.globals.Globals;

public class LoadRoutesAdapter extends BaseAdapter{

	private Context context;	

	public LoadRoutesAdapter(Context context) {
		super();
		//this.number = 6;
		this.context = context;
	}
	
	@Override
	public int getCount() {
		return Globals.loadedRoutes.size();
	}

	@Override
	public Object getItem(int arg0) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public long getItemId(int arg0) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		LayoutInflater inflater = (LayoutInflater) this.context
				.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		View rowView = inflater.inflate(R.layout.load_routes_item,
				parent, false);
		TextView tvPhone = (TextView) rowView
				.findViewById(R.id.tvLoadRoutesPhone);
		TextView tvNickName = (TextView) rowView
				.findViewById(R.id.tvLoadRoutesName);
		TextView tvDesc = (TextView) rowView
				.findViewById(R.id.tvLoadRoutesDesc);

		tvPhone.setText(Globals.loadedRoutes.get(position).getSrcPhoneNumber());
		tvNickName.setText(Globals.loadedRoutes.get(position).getSrcName());
		tvDesc.setText(Globals.loadedRoutes.get(position).getDesc());
		return rowView;	
	}
}
